package com.zc.designmodel.creative.singleton;

/**
 * @author: zhuCan
 * @date: 2020/4/11 15:31
 * @description: 静态内部类单例
 *   主要是利用classloader 延迟加载静态内部类现实,并确保安全
 */
public class StaticSingleton {

  private StaticSingleton(){}

  public static class Holder{
    private static final StaticSingleton instance = new StaticSingleton();
  }

  public static StaticSingleton getInstance(){
    return Holder.instance;
  }
}
